<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="100px">
      <el-row :gutter="20">
        <el-col :span="6"> 
          <el-form-item label="stock_name">
            <el-input v-model="form.name" />
          </el-form-item></el-col>
        <el-col :span="6">
          <el-form-item label="stock_code">
            <el-input v-model="form.code" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="板块">
            <el-input v-model="form.bankuai" />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="6">
          <el-form-item label="startTime">
          <el-date-picker value-format="yyyy-MM-dd"
          v-model="form.startTime" type="date" placeholder="Pick a date" style="width: 100%;" />
      </el-form-item>
        </el-col> -->
        <!-- <el-col :span="6">
          <div class="grid-content bg-purple"></div>
        </el-col> -->
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="是否long">
            <el-select v-model="form.isLong" placeholder="please select your zone">
              <el-option label="是" value="1" />
              <el-option label="否" value="0" />
            </el-select>
          </el-form-item>
        </el-col >
        <el-col :span="6">
          <el-form-item label="是否zhong">
            <el-select v-model="form.iszhongjunbuzhang" placeholder="please select your zone">
              <el-option label="是" value="1" />
              <el-option label="否" value="0" />
            </el-select>
          </el-form-item>
        </el-col >
        <el-col :span="6">
          <el-form-item label="是否hou">
            <el-select v-model="form.ishoubai" placeholder="please select your zone">
              <el-option label="是" value="1" />
              <el-option label="否" value="0" />
            </el-select>
          </el-form-item>
        </el-col >
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="lianBan">
            <el-input v-model="form.lianBan" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="jycl">
            <el-input v-model="form.jycl" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="jjyq">
            <el-input v-model="form.jjyq" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="yqsx">
            <el-input v-model="form.yqsx" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="yaliwei">
            <el-input v-model="form.yaliwei" />
          </el-form-item>
        </el-col>
      </el-row>
      <!-- <el-form-item label="Activity zone">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="光伏" value="1" />
          <el-option label="酒" value="2" />
          <el-option label="地产" value="3" />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="Activity zone">
        <el-select v-model="form.region" placeholder="please select your zone">
          <el-option label="Zone one" value="shanghai" />
          <el-option label="Zone two" value="beijing" />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="Instant delivery">
        <el-switch v-model="form.delivery" />
      </el-form-item>
      <el-form-item label="Activity type">
        <el-checkbox-group v-model="form.type">
          <el-checkbox label="Online activities" name="type" />
          <el-checkbox label="Promotion activities" name="type" />
          <el-checkbox label="Offline activities" name="type" />
          <el-checkbox label="Simple brand exposure" name="type" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="Resources">
        <el-radio-group v-model="form.resource">
          <el-radio label="Sponsor" />
          <el-radio label="Venue" />
        </el-radio-group>
      </el-form-item> -->
      <!-- <el-form-item label="beizhu">
        <el-input v-model="form.desc" type="textarea" />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" @click="onSubmit">Create</el-button>
        <el-button @click="onCancel">Cancel</el-button>
      </el-form-item>
    </el-form>
    <div>

    </div>
  </div>
</template>

<script>
import axios from 'axios';
export default {
  data() {
    return {
      form: {
        code:"",
        name:"",
        bankuai:"",

      }
    }
  },
  methods: {
    onSubmit() {
      this.add()
      // this.$message('submit!')
    },
    onCancel() {
      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    },
    add(){
      let pramas = JSON.parse(JSON.stringify(this.form))
      console.log('提交参数',pramas)
      axios({
          //https://www.mairui.club/hsdata.html
          method: 'post',
          url: 'http://localhost:3000/agudata',
          headers: {
              'Content-Type': 'application/json'
          }, // axios会自动将数据转换为JSON格式  
          data:pramas
      })
      .then(response => {
          res= response.data
          console.log('返回数据', res); // 处理响应数据  
      })
      .catch(error => {
          console.error('Error:', error); // 处理错误  
      });
    }

  }
}
</script>

<style scoped>
.line {
  text-align: center;
}
</style>
